﻿using LearnWPF.Utils;
using Stylet;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LearnWPF.Pages
{
    public class PageComboBoxViewModel : Stylet.Screen
    {
        protected override void OnViewLoaded()
        {
            base.OnViewLoaded();

            this.Bind(s => SelectedAlarmLevel, (o, e) => SelectedAlarmLevelChanged());
        }            

        public List<AlarmLevel> AlarmLevelList { get; set; } = EnumHelper<AlarmLevel>.ToList();
        public AlarmLevel SelectedAlarmLevel { get; set; }

        public void Show()
        {
            Debug.WriteLine($"You selected : {SelectedAlarmLevel}");  
        }

        private void SelectedAlarmLevelChanged()
        {
            Debug.WriteLine($"SelectedAlarmLevelChanged. Current is : {SelectedAlarmLevel}");
        }
    }

    public enum AlarmLevel
    {
        [Description("正常")]
        Normal = 0,

        [Description("警报")]
        Warring = 1,

        [Description("故障")]
        Error = 2,
    }
}
